***************************************************
*****************Release or Repress?***************
************************Lee************************
********************Nov 23, 2023*******************
***************************************************

* Analysis run using Stata18 *
version 18

* Set Working Directory *
cd "/Users/LeeJoonHyeok/Desktop/Financial Liberalization" // change working directory
use "Replication_main.dta", clear

** Main Results **

xtset ccode year
global controls targ_pop_log targ_gdppc_log targ_gdpgrowth lntrade_open peg underimf

* Table 1: Estimates of Capital Account Openness in Target States *

xtreg ckaopen2010 i.l.sanction_onset i.democracy $controls i.year, fe cl(ccode)
xtreg ckaopen2010 i.l.sanction_onset##i.democracy $controls i.year, fe cl(ccode)
xtreg ckaopen2010 i.l.sanction_onset c.vdem $controls i.year, fe cl(ccode)
xtreg ckaopen2010 i.l.sanction_onset##c.vdem $controls i.year, fe cl(ccode)

* Figure 1: Democracies, autocracies, and economic sanctions' effect on capital account openness: (a) coefficients and (b) marginal effects *

xtreg ckaopen2010 l.sanction_onset##i.democracy $controls i.year, fe cl(ccode)
estimates store fordem
coefplot fordem, keep (0bL.sanction_onset 1L.sanction_onset 1.democracy 1L.sanction_onset#1.democracy) coeflabels (0bL.sanction_onset = "Untargeted Autocracy" 1L.sanction_onset = "Targeted Autocracy" 1.democracy = "Untargeted Democracy" 1L.sanction_onset#1.democracy = "Targeted Democracy") xlabel(,format(%9.1f)) xline(0, lstyle(grid) lcolor(gs8) lpattern(dash)) levels(95 90) graphregion(color(white)) order(0bL.sanction_onset 1L.sanction_onset 1.democracy 1L.sanction_onset#1.democracy) xtitle(Effect on Capital Account Openness)

xtreg ckaopen2010 l.sanction_onset##i.democracy $controls i.year, fe cl(ccode)
margins, dydx(l.sanction_onset) over(democracy)
marginsplot, yline(0, lstyle(grid) lcolor(gs8) lpattern(dash)) xlabel(0 "Autocracy" 1 "Democracy") graphregion(color(white))

* Figure 2: Effect of economic sanctions on capital account openness contingent on level of democracy: (a) marginal effects and (b) predictions *

xtreg ckaopen2010 l.sanction_onset##c.vdem $controls i.year, fe cl(ccode)
margins, dydx(l.sanction_onset) at(vdem=(0 (.05) 1))
marginsplot, yline(0, lstyle(grid) lcolor(gs8) lpattern(dash)) addplot(hist vdem if e(sample), below percent bin(200) lcolor(black*0.5) fcolor(white) yaxis(2) yscale(off axis(2))) graphregion(color(white)) legend (off)    scheme(s1mono)  recastci(rline) recast(line)

xtreg ckaopen2010 l.sanction_onset##c.vdem $controls i.year, fe cl(ccode)
margins, at (l.sanction_onset = (0 1) vdem = (0 (.1) 1))
marginsplot, x(vdem) l(95) graphregion(color(white))

* Table 2: Estimates of Capital Account Openness in Target States with an indicator for ongoing sanctions *

xtreg ckaopen2010 sanctepisode##i.democracy $controls dyear dyear2 dyear3, fe cl(ccode)
xtreg ckaopen2010 sanctepisode##c.vdem $controls dyear dyear2 dyear3, fe cl(ccode)

* Table 3: Estimates of Capital Account Openness in Target States with more lagged Sanction Onset variables *

xtreg ckaopen2010 l.sanction_onset##i.democracy l2.sanction_onset##i.democracy l3.sanction_onset##i.democracy $controls i.year, fe cl(ccode)
xtreg ckaopen2010 l.sanction_onset##c.vdem l2.sanction_onset##c.vdem l3.sanction_onset##c.vdem $controls i.year, fe cl(ccode)

** Appendix **

* Table A1: Summary Statistics *

xtreg ckaopen2010 l.sanction_onset##i.democracy $controls i.year, fe cl(ccode)
sum ckaopen2010 sanction_onset democracy targ_pop_log targ_gdppc_log targ_gdpgrowth lntrade_open peg underimf if e(sample)
xtreg ckaopen2010 l.sanction_onset##c.vdem $controls i.year, fe cl(ccode)
sum vdem if e(sample)

* Figure A1: Test for Linearity Assumption in Interaction Models: (a) binning estimator and (b) kernel estimator *

* It requires interflex package, made by Hainmuelle et al. (2016)
* ssc install interflex, replace all
interflex ckaopen2010 lag_sanction_onset vdem $controls, fe(ccode year) cl(ccode) xd(density)
interflex ckaopen2010 lag_sanction_onset vdem $controls, fe(ccode year) cl(ccode) xd(density) type(kernel) // it takes several minutes

* Table A2: Mechanism Testing: the effect of ongoing sanctions on debt composition contingent on regime type *

global controls1 targ_pop_log targ_gdppc_log targ_gdpgrowth lntrade_open peg

xtreg extratio sanctepisode $controls1 dyear dyear2 dyear3 if democracy == 1, fe cl(ccode)
xtreg extratio sanctepisode $controls1 dyear dyear2 dyear3 if democracy == 0, fe cl(ccode)

* Table A3: Estimates of capital account openness in non-G7 targets *

xtreg ckaopen2010 i.l.sanction_onset i.democracy $controls i.year if G7 == 0, fe cl(ccode)
xtreg ckaopen2010 i.l.sanction_onset##i.democracy $controls i.year if G7 == 0, fe cl(ccode)
xtreg ckaopen2010 i.l.sanction_onset c.vdem $controls i.year if G7 == 0, fe cl(ccode)
xtreg ckaopen2010 i.l.sanction_onset##c.vdem $controls i.year if G7 == 0, fe cl(ccode)

* Table A4: Estimates of capital account openness in target states from mixed-effects models *

xtmixed ckaopen2010 l.sanction_onset##i.democracy $controls i.year || ccode:
xtmixed ckaopen2010 l.sanction_onset##c.vdem $controls i.year || ccode:

* Figure A2: Marginal effects from mixed-effects models *

xtmixed ckaopen2010 l.sanction_onset##c.vdem $controls i.year || ccode:
margins, dydx(l.sanction_onset) at(vdem=(0 (.05) 1))
marginsplot, yline(0, lstyle(grid) lcolor(gs8) lpattern(dash)) addplot(hist vdem if e(sample), below percent bin(200) lcolor(black*0.5) fcolor(white) yaxis(2) yscale(off axis(2))) graphregion(color(white)) legend (off)    scheme(s1mono)  recastci(rline) recast(line)

* Table A5: Estimates of Capital Account Openness in Target States with Ordinal Measures for Capital Account Openness *

xtreg intlcapital l.sanction_onset##i.democracy $controls i.year, fe cl(ccode)
xtreg intlcapital l.sanction_onset##c.vdem $controls i.year, fe cl(ccode)

* Figure A3: Marginal effects on Capital Account Transaction (Ordinal) *

xtreg intlcapital l.sanction_onset##c.vdem $controls i.year, fe cl(ccode)
margins, dydx(l.sanction_onset) at(vdem=(0 (.05) 1))
marginsplot, yline(0, lstyle(grid) lcolor(gs8) lpattern(dash)) graphregion(color(white)) legend (off)    scheme(s1mono)  recastci(rline) recast(line)

* Table A6: Estimates of Capital Account Openness in Target States with other potential confounders *

xtreg ckaopen2010 l.sanction_onset##c.vdem $controls targ_mid targ_civ_war i.year, fe cl(ccode)
xtreg ckaopen2010 l.sanction_onset##c.vdem $controls institution i.year, fe cl(ccode)
xtreg ckaopen2010 l.sanction_onset##c.vdem $controls findevelop i.year, fe cl(ccode)

* Table A7: Estimates from Double Demeaning Approach *

center ckaopen2010 lag_sanction_onset vdem $controls, inplace // centering variables

foreach var of varlist lag_sanction_onset vdem{
egen mean`var'=mean(`var'), by (ccode)
generate dm`var'=`var'-mean`var' 
}
generate int_lag_sanction_onset_vdem= dmlag_sanction_onset * dmvdem

xtreg ckaopen2010 lag_sanction_onset vdem int_lag_sanction_onset_vdem $controls i.year, fe cl(ccode)

* Table A8: Estimates of capital account openness in target states with dyadic data *

use "Replication_dyad.dta", clear

xtset dyad year

global controls3 log_gdppc1 log_gdppc2 log_pop1 log_pop2 caprat dyad_balance
global controls4 log_gdppc1 log_gdppc2 log_pop1 log_pop2 caprat dyad_balance peg underimf

xtreg ckaopen2010 i.l.imposition##i.democracy $controls3 i.year, fe cl(dyad)
xtreg ckaopen2010 i.l.imposition##i.democracy $controls4 i.year, fe cl(dyad)
xtreg ckaopen2010 i.l.imposition##c.vdem $controls3 i.year, fe cl(dyad)
xtreg ckaopen2010 i.l.imposition##c.vdem $controls4 i.year, fe cl(dyad)

* Table A9: Estimates of capital account openness in target states with extended dataset through 2010 *

use "Replication_ext.dta", clear

xtset ccode year

global controls1 targ_pop_log targ_gdppc_log targ_gdpgrowth lntrade_open peg
global controls2 targ_pop_log targ_gdppc_log targ_gdpgrowth lntrade_open peg underimf

xtreg ckaopen2010 i.l.sanction_onset##i.democracy $controls1 i.year, fe cl(ccode)
xtreg ckaopen2010 i.l.sanction_onset##i.democracy $controls2 i.year, fe cl(ccode)
xtreg ckaopen2010 i.l.sanction_onset##c.vdem $controls1 i.year, fe cl(ccode)
xtreg ckaopen2010 i.l.sanction_onset##c.vdem $controls2 i.year, fe cl(ccode)

* Table A10: Heckman Selection Model of Sanctions and Capital Account Openness *

use "Replication_main.dta", clear

xtset ccode year
global controls targ_pop_log targ_gdppc_log targ_gdpgrowth lntrade_open peg underimf

heckman ckaopen2010 vdem $controls, select(l.sanction_onset = l.vdem l.targ_pop_log l.targ_gdppc_log l.targ_gdpgrowth l.targ_mid l.targ_civ_war l.targ_cap l.lntrade_open l.dyear l.dyear2 l.dyear3) robust cluster(ccode) nolog

* Figure A4: Comparison on Electoral Democracy Index between Countries Targeted with Financial Sanctions and Non-targeted Countries *

graph box vdem, over(financial)

* Table A11: Estimates of Capital Account Openness in Target States (Financial Sanctions) *

xtreg ckaopen2010 i.l.financial i.democracy $controls i.year, fe cl(ccode)
xtreg ckaopen2010 i.l.financial##i.democracy $controls i.year, fe cl(ccode)
xtreg ckaopen2010 i.l.financial c.vdem $controls i.year, fe cl(ccode)
xtreg ckaopen2010 i.l.financial##c.vdem $controls i.year, fe cl(ccode)

* Figure A5: Democracies, autocracies, and financial sanctions' effect on capital account openness: (a) coefficients and (b) marginal effects *

xtreg ckaopen2010 l.financial##i.democracy $controls i.year, fe cl(ccode)
estimates store fordem_fin
coefplot fordem_fin, keep (0bL.financial 1L.financial 1.democracy 1L.financial#1.democracy) coeflabels (0bL.financial = "Untargeted Autocracy" 1L.financial = "Targeted Autocracy" 1.democracy = "Untargeted Democracy" 1L.financial#1.democracy = "Targeted Democracy") xlabel(,format(%9.1f)) xline(0, lstyle(grid) lcolor(gs8) lpattern(dash)) levels(95 90) graphregion(color(white)) order(0bL.financial 1L.financial 1.democracy 1L.financial#1.democracy) xtitle(Effect on Capital Account Openness)

xtreg ckaopen2010 l.financial##i.democracy $controls i.year, fe cl(ccode)
margins, dydx(l.financial) over(democracy)
marginsplot, yline(0, lstyle(grid) lcolor(gs8) lpattern(dash)) xlabel(0 "Autocracy" 1 "Democracy") graphregion(color(white))

* Figure A6: Effect of financial sanctions on capital account openness contingent on level of democracy: (a) marginal effects and (b) predictions *

xtreg ckaopen2010 l.financial##c.vdem $controls i.year, fe cl(ccode)
margins, dydx(l.financial) at(vdem=(0 (.05) 1))
marginsplot, yline(0, lstyle(grid) lcolor(gs8) lpattern(dash)) addplot(hist vdem if e(sample), below percent bin(200) lcolor(black*0.5) fcolor(white) yaxis(2) yscale(off axis(2))) graphregion(color(white)) legend (off)    scheme(s1mono)  recastci(rline) recast(line)

xtreg ckaopen2010 l.financial##c.vdem $controls i.year, fe cl(ccode)
margins, at (l.financial = (0 1) vdem = (0 (.1) 1))
marginsplot, x(vdem) l(95) graphregion(color(white))

* Figure A7: Comparison on Capital Account Openness between Democracies and Autocracies *

graph box ckaopen2010, over(democracy)

* Table A12: Effect of Capital Account Openness on Sanction Onset (1) *

logit sanction_onset ckaopen2010 vdem targ_pop_log targ_gdppc_log targ_gdpgrowth targ_mid targ_civ_war targ_cap lntrade_open dyear dyear2 dyear3, cl(ccode)

* Table A13: Effect of Capital Account Openness on Sanction Onset (2) *

melogit sanction_onset ckaopen2010 vdem targ_pop_log targ_gdppc_log targ_gdpgrowth targ_mid targ_civ_war targ_cap lntrade_open dyear dyear2 dyear3 || ccode:

** References **

* Jens Hainmueller, Jonathan Mummolo, and Yiqing Xu. 2016. "How Much Should We Trust Estimates from Multiplicative Interaction Models? Simple Tools to Improve Empirical Practice." Available at SSRN: https://papers.ssrn.com/abstract_id=2739221.
